<template>
  <div class="a_head" :class="{bg_fff:is_bg,ispc:mobile==2}">
      <div class="container db">
        <div @click="go_back()" class="back" v-if="is_bg"><img src="../assets/images/ico_back2.png" alt=""></div>
        <div @click="go_back()" class="back" v-else><img src="../assets/images/ico_back2.png" alt=""></div>
        <div class="flex tac name">
          <span>{{titleSize}}</span>
        </div>
        <div class="str sub"  @click="preserve" v-html="titleRight">
        </div>
      </div>
  </div>
</template>
<script>
  export default {
    data(){
      return{
        mobile:localStorage.getItem('ismobile'),
      }
    },
    name:"titleCenter",
    props:{
      is_mt:{
        default:""
      },
      is_bg:{
        default:"true"
      },
      is_back:{
        default:"true"
      },
      titleSize:{
        default:"主页",
      },
      titleRight:{
        default:""
      },
      routerGo: {
        type: String,
        default: "",
      },
      is_holdBack: {
        type: Boolean,
        default: false
      },
    },
    methods:{
      preserve(){
        this.$emit('preserve')
      },
      go_back(){
        if(this.is_holdBack){
          this.$emit('handleParentFn')
        }else{
          if (this.routerGo == "")
          {
            this.$router.go(-1);
          } else {
            this.$router.push(this.routerGo);
          }
        }
      }
    }
  }
</script>
<style lang="less" scoped>
  //通用头部样式
  .a_head.bg_fff {
    background: #FFFFFF;
  }
  .a_head {
    padding: 0.22rem 0;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 11;
    color: #323232;
    .back,
    .str {
      min-width: 0.48rem;
      height: 0.48rem;
      line-height: 0.48rem;
      img {
        height: 0.48rem;
      }
    }
    .str {
      text-align: right;
      font-size: 0.34rem;
    }
    .icon-subnav {
      font-size: 0.56rem;
    }
    .icon-left {
      font-size: 0.4rem;
    }
    .flex {
      margin: 0 0.2rem;
      &.name {
        font-size: 0.34rem;
        display: flex;
          align-items: left;
          justify-content: space-around;
          flex-direction: column;
          line-height: .4rem;
      }
      .abs {
        left: 0.22rem;
        top: 0.06rem;
        i {
          font-size: 0.4rem;
          color: #fff;
        }
      }
      .inp {
        width: 100%;
        display: block;
        padding: 0 0.2rem 0 0.7rem;
        height: 0.68rem;
        background: rgba(147, 151, 173, 0.1);
        border-radius: 0.34rem;
        border: 0;
        font-size: 0.3rem;
        -webkit-box-sizing: border-box;
        -moz-box-sizing: border-box;
        box-sizing: border-box;
      }
    }
    .txt {
      font-size: 0.32rem;
      width: auto;
    }
  }
</style>
